#include <bits/stdc++.h>

#define eb emplace_back
#define ep emplace
#define fi first
#define se second
#define in read<int>()
#define lin read<ll>()
#define rep(i, x, y) for(int i = (x); i <= (y); i++)
#define per(i, x, y) for(int i = (x); i >= (y); i--)

using namespace std;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using vec = vector < int >;
using veg = vector < pii >;

template < typename T > T read() {
	T x = 0; bool f = 0; char ch = getchar();
	while(!isdigit(ch)) f |= ch == '-', ch = getchar();
	while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = getchar();
	return f ? -x : x;
}

template < typename T > void chkmax(T &x, const T &y) { x = x > y ? x : y; }
template < typename T > void chkmin(T &x, const T &y) { x = x < y ? x : y; }

const int inf = 0x3f3f3f3f;

int n, m;

namespace F { //zkw_cost_flow
#define epr(i, x, y) for(int i = h[x], y = e[i].v; i; i = e[i].nxt, y = e[i].v)
#define epp(i, h, x, y) for(int i = h[x], y = e[i].v; i; i = e[i].nxt, y = e[i].v)
	const int N = 5e3 + 10;
	const int M = 5e4 + 10;
	struct edge { int v, w, c, nxt; } e[M << 1];
	int h[N], cnt = 1, S, T, dis[N], now[N];
	bool vis[N];
	int mxflow, cost;
	void tlink(int x, int y, int w, int c) { e[++cnt] = (edge) { y, w, c, h[x] }; h[x] = cnt; }
	void link(int x, int y, int w, int c) { tlink(x, y, w, c); tlink(y, x, 0, -c); }
	void setst(int s, int t) { S = s; T = t; }
	bool update() {
		int delta = inf; if(vis[T]) return true;
		rep(x, 1, n) if(vis[x]) epr(i, x, y) if(e[i].w && !vis[y]) chkmin(delta, dis[x] + e[i].c - dis[y]);
		if(delta == inf) return false; rep(x, 1, n) if(vis[x]) dis[x] -= delta;
		return true;
	}
	int dfs(int x, int flow) {
		vis[x] = true;
		if(x == T) return mxflow += flow, cost -= dis[S] * flow, flow;
		int tot = flow, t = 0;
		epp(i, now, x, y) {
			now[x] = i;
			if(e[i].w && dis[y] == dis[x] + e[i].c && !vis[y]) {
				t = dfs(y, min(tot, e[i].w)), tot -= t, e[i].w -= t, e[i ^ 1].w += t;
				if(tot == 0) break;
			}
		} return flow - tot;
	}
	void runit() { dis[S] = -inf; do { memset(vis, 0, sizeof vis); memcpy(now, h, sizeof h); dfs(S, inf); } while(update()); }
}

int main() {
#ifndef ONLINE_JUDGE
	freopen("1.in", "r", stdin);
#endif
	n = in, m = in; int s = in, t = in;
	rep(i, 1, m) { int u = in, v = in, w = in, c = in; F :: link(u, v, w, c); }
	F :: setst(s, t); F :: runit(); printf("%d %d\n", F :: mxflow, F :: cost);
	return 0;
}
